<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Array.indexOf()</title>
</head>

<body>
    <h1>JavaScript Array.indexOf()</h1>
    <p id="demo"></p>
    <script>
        var fruits = ["A", "Q", "O", "Z"];
        var a = fruits.indexOf("B")
        document.getElementById("demo").innerHTML = "Apple 被找到的位置是：" + (a + 1);
    </script>
    <p>Internet Explorer 8 或更早的版本不支持 indexOf()。</p>
</body>

</html>